package controllers.customer;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mysql.jdbc.Statement;

import component.UserBis;
import hprose.HproseClinetService;
import constants.APIConstants;
import constants.Constants;
import controllers.common.filter.BaseFilter;
import play.mvc.Controller;
import utils.convert.Convert;
import utils.logs.LogsUtils;

public class CustomerInfoAction extends BaseFilter {
	
	/**
	 * 获取客户操作员持有刀具限制
	* @Title: index 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param     设定文件 
	* @return void    返回类型 
	* @author chasel 641243343@qq.com   
	* @throws
	 */
	public static void index(){
		Map<String, Object> map = new HashMap<String, Object>();
		Object [] arguments = new Object[]{map};
		map.put("customer_id", UserBis.currUser());
		String res = HproseClinetService.synCall(APIConstants.CIMSI_GETOPERATORCUTTERLIMIT,arguments, APIConstants.CUSTOMER_HOST, APIConstants.CUSTOMER_PORT);
		JSONObject obj = JSONObject.parseObject(res);
		render(obj);
	}
	/**
	 * 设置客户操作员持有刀具限制
	* @Title: ajaxGetUserList 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param     设定文件 
	* @return void    返回类型 
	* @author chasel 641243343@qq.com   
	* @throws
	 */
	public static void save(){
		Map<String, Object> map = new HashMap<String, Object>();
		Object [] arguments = new Object[]{map};
		map.put("customer_id", UserBis.currUser());
		map.put("operator_max_num", params.get("operator_max_num"));
		map.put("operator_remind_num", params.get("operator_remind_num"));
		LogsUtils.addLogs(Constants.LOG_TYPE_UPDATE,Convert.convertToInt(UserBis.currOperatorId(),-1), 1, "执行操作员领刀限制修改","success", UserBis.currLoginAccount(), UserBis.currUserName(), UserBis.currUser());
		String res = HproseClinetService.synCall(APIConstants.CIMSI_SETOPERATORCUTTERLIMIT, arguments, APIConstants.CUSTOMER_HOST, APIConstants.CUSTOMER_PORT);
		renderJSON(res);
	}
}
